/*
*Copyright (c) Nikhil Jain.
*Project ICARUS, communications and 
*artificial intelligence.
*/



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package javadrone.command.commandset;

//~--- non-JDK imports --------------------------------------------------------

import javadrone.command.CommandDescriptor;
import javadrone.command.CommandExecutor;
import javadrone.command.ExecutorException;
import javadrone.command.SynchronousCommand;

//~--- JDK imports ------------------------------------------------------------

import java.util.concurrent.TimeUnit;

import javax.vecmath.Vector3d;

/**
 *
 * @author Nikzzay
 */
public class ManeuverCommand extends SynchronousCommand {
    private Vector3d translation, rotation;

    public ManeuverCommand(Vector3d translation, Vector3d rotation, long timeOut, TimeUnit sourceUnit) {
        super(timeOut, sourceUnit);
        this.translation = translation;
        this.rotation    = rotation;
    }

    @Override
    public void execute(CommandExecutor ce) throws ExecutorException {
        if (translation != null) {
            ce.translateBy(translation);
        }

        if (rotation != null) {
            ce.rotateBy(rotation);
        }
    }

    @Override
    public CommandDescriptor getDescriptor() {
        return CommandDescriptor.MANEUVER;
    }

    @Override
    public String toString() {
        return "COMMAND: MANEUVER- TRANSLATE: " + translation + " ROTATE: " + rotation;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
